﻿
using System.Collections.ObjectModel;
using System.Windows;

namespace SoonCode.FocusTest.Models
{
    public class GlobalModel
    {
        public static int ver = 31;
        public static string verName = "1.0.0.31";
        public static string AccountDir = "";
        private static GlobalModel singleton;
        private static readonly object lockObject = new Object();
        

        private GlobalModel() { }
        public UserInfo UserInfo { get; set; }
        public OrgInfo OrgInfo { get; set; }
        public MemberInfo MemberInfo { get; set; }
        public TestInfo TestInfo { get; set; }
        public string Teacher { get; set; }
        public ObservableCollection<ClassesInfo> ClassesList;

        public Window TeacherWidnow { get; set; }

        public static GlobalModel Instance
        {
            get
            {
                lock (lockObject)
                {
                    if (singleton == null) singleton = new GlobalModel();
                    return singleton;
                }
            }
        }

        public static bool ShowClass()
        {
            return Instance.ClassesList!=null&&Instance.ClassesList.Count>0;
        }
        public static string Token
        {
            get
            {
                return Instance.UserInfo.Token;
            }
        }
    }
}
